package com.situ.fly.controller;

import java.util.Date;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import com.situ.fly.util.VerCodeUtil;

@Controller
public class VerCodeController {

	/**
	 * 返回一张验证码图片
	 */
	@GetMapping("/verCode")
	public void verCode(HttpServletResponse response, HttpSession session) {
		
		// 调用工具类
		String verCode = VerCodeUtil.createVerCode(response);
		
		session.setAttribute("verCode", verCode);
		
		// 记录生成时间
		Date genTime = new Date();// 获取当前系统时间
		
		session.setAttribute("genTime", genTime);
	}
}
